package com.threeigtache.adpter;

import android.content.Context;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.threeigtache.been.NoticeBeen;
import com.threeigtache.threeigproject.R;

import java.util.List;


/**
 * Created by 赵航 on 2018/3/2.
 */

public class EmailActivtyAdapter extends BasicRecycleViewAdapter<NoticeBeen.ListBean>  {
    private String                    data;
    private List<NoticeBeen.ListBean> mList;
    private Context                   mContext;

    public EmailActivtyAdapter(Context context, String getData, List<NoticeBeen.ListBean> showItems) {
        super(showItems);
        this.data = getData;
        this.mList = showItems;
        this.mContext = context;
    }

    @Override
    public void convert(BasicViewholder holder, NoticeBeen.ListBean itm, int position) {

        ImageView imageView = (ImageView) holder.getView(R.id.image);
        TextView context = (TextView) holder.getView(R.id.content);
        TextView time = (TextView) holder.getView(R.id.time);

        //设置图片
        Glide.with(mContext).
                load(itm.getPic()).
                asBitmap().
                placeholder(R.drawable.code).//加载中显示的图片
                error(R.drawable.code).//加载失败时显示的图片
                into(imageView);

//        GlideApp
//                .with(myFragment)
//                .load(url)
//                .centerCrop()
//                .placeholder(R.drawable.loading_spinner)
//                .into(myImageView);
        //设置文字
        context.setText(itm.getCon());
        //设置时间
        time.setText(itm.getDate());

    }

    @Override
    public int getSuccessFullView(int viewType) {
        return R.layout.campaign_layout;
    }
}
